/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bea.cliente.gui.styles;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.builder.EffectBuilder;
import de.lessvoid.nifty.builder.HoverEffectBuilder;
import de.lessvoid.nifty.builder.StyleBuilder;
import de.lessvoid.nifty.tools.Color;

/**
 *
 * @author ivan
 */
public class TextFieldStyles {

    public static String NIFTY_STYLE = "nifty-textfield";
    public static String BLACK_STYLE = "blackStyleTextField";

    public static void init(Nifty nifty) {
        /**
         * Configura o BLACK_STYLE
         */
        // #frame
        new StyleBuilder() {

            {
                id(BLACK_STYLE + "#panel");
                childLayoutOverlay();
                height("23px");
            }
        }.build(nifty);
        // #field
        new StyleBuilder() {

            {
                id(BLACK_STYLE + "#field");
                visibleToMouse(true);
                childClip(true);
                backgroundColor("#666f");
                padding("0px,2px");
                childLayoutCenter();
                // onActive
                onActiveEffect(new EffectBuilder("border") {

                    {
                        color("#222f");
                        post(true);
                        inset("1px");
                    }
                });
                // onFocus
                onFocusEffect(new EffectBuilder("colorBar") {

                    {
                        color("#000f");
                        post(true);
                        inset("1px");
                    }
                });
                // onHover
                onHoverEffect(new HoverEffectBuilder("changeMouseCursor") {

                    {
                        id("textFieldCursor");
                    }
                });
                // onHover
                onHoverEffect(new HoverEffectBuilder("border") {

                    {
                        color("#822f");
                        post(true);
                    }
                });
                onActiveEffect(new EffectBuilder("renderQuad") {

                    {
                        set("startColor", "#2228");
                        set("endColor", "#2220");
                        post(true);
                        length(150);
                    }
                });
            }
        }.build(nifty);
        // #text
        new StyleBuilder() {

            {
                id(BLACK_STYLE + "#text");
                base(FontsStyles.GENERAL_WHITE_TEXT_16);
                color(Color.WHITE);
                selectionColor(Color.BLACK);
                visibleToMouse(true);
                alignLeft();
                valignCenter();
                textHAlignLeft();
                // onFocus
                onFocusEffect(new EffectBuilder("textColor") {

                    {
                        post(false);
                        color("#cccf");
                    }
                });
            }
        }.build(nifty);
        // #cursor-panel
        new StyleBuilder() {

            {
                id(BLACK_STYLE + "#cursor-panel");
                childLayoutAbsolute();
                padding("0px,2px");
            }
        }.build(nifty);
        // #cursor
        new StyleBuilder() {

            {
                id(BLACK_STYLE + "#cursor");
                set("filename", "textfield/cursor-empty.png");
                onCustomEffect(new EffectBuilder("imageOverlayPulsate") {

                    {
                        length(250);
                        timeType("infinite");
                        effectParameter("pulsateType", "rectangle");
                        effectParameter("filename", "textfield/cursor.png");
                        post(true);
                    }
                });
            }
        }.build(nifty);
    }
}
